package Project;
//___________________________IMPORTACIONES______________________________________

import com.toedter.calendar.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.security.*;
import java.sql.*;
import java.text.*;
import java.util.logging.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;
import javax.swing.table.*;
//______________________________________________________________________________

public class Container extends javax.swing.JFrame {
//_____________________________ATRIBUTOS________________________________________

    IngresarConductor Conductor;
    IngresarAccidente Accidente;
    Reporte Reporte;
    IngresarVehiculo Vehiculo;
    Opciones Opciones;
    String Usuario, Contrasena, sql;
    int count = 0;
    int tamanio = 0;
    String clave = "";
    int caracter = 0;
    String a, b;
    Usuario u = new Usuario(this, true);
//_____________________________CONSTRUCTOR______________________________________

    public Container() {
        initComponents();
        
        setLocationRelativeTo(null);
        setResizable(false);
        this.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("Logo_Cooperativa.png")));
        setTitle("Siconacci - Coop. Trans. Occidente");
        pnlLogin();
        desactivarMenu();
        fecha();
        lblIdDocumentos.setVisible(false);
        jLabel16.setText("");
        dcFechaDocumentos.setVisible(false);
    }
//________________________________METODOS_______________________________________

 
//______________________________________________________________________________

    private void desactivarMenu() {
        menOpciones.setEnabled(false);
        menRepor.setEnabled(false);
        menUsuarios.setVisible(false);
        menDoc.setEnabled(false);
//______________________________________________________________________________
    }

    private void ocultarColumnas() {
        tablaDocumentos.getColumnModel().getColumn(2).setMaxWidth(0);
        tablaDocumentos.getColumnModel().getColumn(2).setMinWidth(0);
        tablaDocumentos.getColumnModel().getColumn(2).setPreferredWidth(0);
        tablaDocumentos.getColumnModel().getColumn(2).setResizable(false);
    }
//______________________________________________________________________________

    private void activarMenu() {
        menOpciones.setEnabled(true);
        menRepor.setEnabled(true);
        menDoc.setEnabled(true);
    }
//______________________________________________________________________________

    private void pnlLogin() {
        pnlContenedorLogin.setLayout(new BorderLayout());
        pnlContenedorLogin.removeAll();
        pnlContenedorLogin.add(pnlLogin, "West");
        pnlContenedorLogin.updateUI();
        pnlContenedorLogin.setVisible(true);
    }
//______________________________________________________________________________

    private void agregarConductor() {
        Conductor = new IngresarConductor();
        pnlContenedor.setLayout(new BorderLayout());
        pnlContenedor.removeAll();
        pnlContenedor.add(Conductor, "West");
        pnlContenedor.updateUI();
        pnlContenedor.setVisible(true);
    }
//______________________________________________________________________________

    private void agregarAccidente() {
        Accidente = new IngresarAccidente();
        pnlContenedor.setLayout(new BorderLayout());
        pnlContenedor.removeAll();
        pnlContenedor.add(Accidente, "West");
        pnlContenedor.updateUI();
        pnlContenedor.setVisible(true);
    }
//______________________________________________________________________________

    private void agregarVehiculo() {
        Vehiculo = new IngresarVehiculo();
        pnlContenedor.setLayout(new BorderLayout());
        pnlContenedor.removeAll();
        pnlContenedor.add(Vehiculo, "West");
        pnlContenedor.updateUI();
        pnlContenedor.setVisible(true);
    }
//______________________________________________________________________________

    private void agregarOpciones() {
        Opciones = new Opciones();
        pnlContenedor.setLayout(new BorderLayout());
        pnlContenedor.removeAll();
        pnlContenedor.add(Opciones, "West");
        pnlContenedor.updateUI();
        pnlContenedor.setVisible(true);
    }
//______________________________________________________________________________

    private void extraerDocumento() throws SQLException, IOException {
        BaseDeDatos.conectarse();

        if (tablaDocumentos.getSelectedRows().length < 1) {
            JOptionPane.showMessageDialog(null, "Seleccione el documento que desea guardar", "Error", JOptionPane.ERROR_MESSAGE);
        } else {
            Statement s = BaseDeDatos.con.createStatement();
            String idDoc = "" + tablaDocumentos.getValueAt(tablaDocumentos.getSelectedRow(), 2);
            String nomDoc = "" + tablaDocumentos.getValueAt(tablaDocumentos.getSelectedRow(), 0);
            sql = "SELECT binario, nombre FROM documentos where id=" + idDoc + " and nombre='" + nomDoc + "'";
            ResultSet rs = s.executeQuery(sql);
            String nombre;

            int indice;
            indice = nomDoc.lastIndexOf(".");
            String extension = nomDoc.substring(indice, nomDoc.length());
            String nomDocFin = nomDoc.substring(0, indice);

            System.out.println(extension);
            FileNameExtensionFilter Filtro = new FileNameExtensionFilter("*" + extension + "", "" + extension + "");
            JFileChooser ruta = new JFileChooser();
            ruta.setFileFilter(Filtro);
            ruta.setSelectedFile(new File("" + nomDocFin));
            int confirmar = ruta.showSaveDialog(this);
            String path = ruta.getSelectedFile().getAbsolutePath();

            if (confirmar != JFileChooser.CANCEL_OPTION) {

                try {
                    rs.next();
                    nombre = rs.getString("nombre");

                    String pathname = path;

                    File file = new File(pathname + extension);
                    FileOutputStream output = new FileOutputStream(file);
                    byte[] archivo = rs.getBytes("binario");

                    ByteArrayInputStream inStream = new ByteArrayInputStream(archivo);
                    int leer = 0;
                    byte[] buffer = new byte[1024];
                    while ((leer = inStream.read(buffer)) != -1) {
                        output.write(buffer, 0, leer);
                    }

                    output.close();
                } catch (Exception ioe) {
                    throw new IOException(ioe.getMessage());
                }
            }
        }
    }
//______________________________________________________________________________

    private void limpiarPanel() {
        pnlContenedor.removeAll();
        pnlContenedor.updateUI();
        pnlContenedor.setVisible(true);
    }
//______________________________________________________________________________

    private void llamarContainer() {
        this.dispose();
        new Container().setVisible(true);
    }
//______________________________________________________________________________

    private void tamanoTabla() {
        int ancho = 849;
        int anchoColumna = 0;
        TableColumnModel modeloColumna = tablaDocumentos.getColumnModel();
        TableColumn columnaTabla;
        for (int i = 0; i < tablaDocumentos.getColumnCount(); i++) {
            columnaTabla = modeloColumna.getColumn(i);
            switch (i) {
                case 0:
                    anchoColumna = (40 * ancho) / 100;
                    break;
                case 1:
                    anchoColumna = (25 * ancho) / 100;
                    break;
            }
            columnaTabla.setPreferredWidth(anchoColumna);
        }
    }
//______________________________________________________________________________

    private void llenarDocumentos(String Valor) {
        BaseDeDatos.conectarse();
        try {

            String consulta = "SELECT documentos.nombre, accidente.fecha, documentos.id AS documentos FROM documentos JOIN accidente ON (documentos.id_accidente = accidente.id)";

            int Valor_dos = cbxFiltrarDocumentos.getSelectedIndex();

            if (Valor_dos == 0) {
                sql = consulta + " WHERE documentos.nombre ILIKE '" + Valor + "%' ORDER BY documentos.nombre";
            } else if (Valor_dos == 1) {
                sql = consulta + " WHERE TO_CHAR(accidente.fecha,'YYYY-MM-DD') = '" + Valor + "' ORDER BY accidente.fecha";
            }

            DefaultTableModel modelo = new DefaultTableModel();
            tablaDocumentos.setModel(modelo);
            modelo.addColumn("DOCUMENTO");
            modelo.addColumn("FECHA");
            modelo.addColumn("ID");

            Statement s = BaseDeDatos.con.createStatement();
            ResultSet rs = s.executeQuery(sql);
            while (rs.next()) {
                // Se crea un array que será una de las filas de la tabla. 
                Object[] fila = new Object[3]; // Hay 2 columnas en la tabla

                // Se rellena cada posición del array con una de las columnas de la tabla en base de datos.
                for (int i = 0; i < 3; i++) {
                    fila[i] = rs.getObject(i + 1); // El primer indice en rs es el 1, no el cero, por eso se suma 1.
                }
                // Se añade al modelo la fila completa.
                modelo.addRow(fila);
            }
            tablaDocumentos.setModel(modelo);
            BaseDeDatos.desconectarse();
            tamanoTabla();
            ocultarColumnas();

        } catch (SQLException e) {
            JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
//______________________________________________________________________________

    public static String md5(String clear) throws Exception {
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] b = md.digest(clear.getBytes());
        int size = b.length;
        StringBuilder h = new StringBuilder(size);
        //algoritmo y arreglo md5
        for (int i = 0; i < size; i++) {
            int u = b[i] & 255;
            if (u < 16) {
                h.append("0").append(Integer.toHexString(u));
            } else {
                h.append(Integer.toHexString(u));
            }
        }
        //clave encriptada
        return h.toString();
    }
//______________________________________________________________________________

    private void Acceder() {
        BaseDeDatos.conectarse();
        try {

            Usuario = txtUsuario.getText().trim();
            try {
                Contrasena = md5(txtContrasena.getText().trim());
            } catch (Exception ex) {
                Logger.getLogger(Container.class.getName()).log(Level.SEVERE, null, ex);
            }

            sql = "SELECT usuario, contrasena, privilegio_id FROM usuarios WHERE usuario = '" + Usuario.toLowerCase() + "' AND contrasena = '" + Contrasena + "'";
            Statement s = BaseDeDatos.con.createStatement();
            ResultSet rs = s.executeQuery(sql);

            while (rs.next()) {
                count = count + 1;
                a = rs.getString("privilegio_id");
                lblPrivilegio.setText(a);
            }

            if (count == 1) {
                JOptionPane.showMessageDialog(pnlContenedorLogin, "Bienvenido al sistema");
                if (lblPrivilegio.getText().equals("1")) {
                    menUsuarios.setVisible(true);
                    activarMenu();
                    limpiarPanel();
                } else {
                    activarMenu();
                    limpiarPanel();
                }

            } else {
                System.out.print(sql);
                JOptionPane.showMessageDialog(pnlContenedorLogin, "Usuario o Contraseña Incorrectos", "Error", JOptionPane.ERROR_MESSAGE);
            }
            BaseDeDatos.desconectarse();
        } catch (SQLException e) {
            System.out.print(sql);
            JOptionPane.showMessageDialog(pnlContenedorLogin, "Se a producido una Exepcion " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
//______________________________________________________________________________

    private void mayusActivado() {

        boolean value = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);

        if (value == true) {
            jLabel16.setText("Bloq Mayús Activado");
        } else if (value == false) {
            jLabel16.setText("");
        }

    }
//______________________________________________________________________________

    private void fecha() {
        ((JTextFieldDateEditor) dcFechaDocumentos.getDateEditor()).addCaretListener(new javax.swing.event.CaretListener() {
            @Override
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                dcFechaCaretUpdate(evt);
            }

            private void dcFechaCaretUpdate(CaretEvent evt) {
                if (dcFechaDocumentos.getDate() != null) {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-d");
                    java.util.Date date = dcFechaDocumentos.getDate();
                    txtBuscarDocumentos.setText(sdf.format(date));
                }
            }
        });
    }
//______________________________________________________________________________

    private void eliminarDocumento() {

        BaseDeDatos.conectarse();

        if (tablaDocumentos.getSelectedRows().length < 1) {
            JOptionPane.showMessageDialog(null, "Seleccione un documento", "Error", JOptionPane.ERROR_MESSAGE);
        } else if (JOptionPane.showConfirmDialog(null, "Esta seguro de que desea eliminar este documento",
                "Advertencia", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_NO_OPTION) {
            try {

                lblIdDocumentos.setText("" + tablaDocumentos.getValueAt(tablaDocumentos.getSelectedRow(), 2));
                String d = lblIdDocumentos.getText();
                sql = "delete  from documentos where id=" + d;
                int resultado = BaseDeDatos.stmt.executeUpdate(sql);
                if (resultado == 1) {
                    JOptionPane.showMessageDialog(null, "El documento a sido eliminado", "Info", JOptionPane.INFORMATION_MESSAGE);
                }

            } catch (SQLException | HeadlessException e) {
                JOptionPane.showMessageDialog(null, "El documento no se pudo borrar", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
        BaseDeDatos.desconectarse();
        llenarDocumentos("");
    }

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlLogin = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        txtUsuario = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        btnIngresar = new javax.swing.JButton();
        txtContrasena = new javax.swing.JPasswordField();
        jLabel16 = new javax.swing.JLabel();
        dlgAbout = new javax.swing.JDialog();
        jLabel7 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        lblPrivilegio = new javax.swing.JLabel();
        dlgDocumentos = new javax.swing.JDialog();
        cbxFiltrarDocumentos = new javax.swing.JComboBox();
        jLabel17 = new javax.swing.JLabel();
        txtBuscarDocumentos = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tablaDocumentos = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int colIndex) {
                return false; //Disallow the editing of any cell
            }
        };
        btnAbrir = new javax.swing.JButton();
        btnEliminarDocumento = new javax.swing.JButton();
        dcFechaDocumentos = new com.toedter.calendar.JDateChooser();
        lblIdDocumentos = new javax.swing.JLabel();
        pnlContenedor = new javax.swing.JPanel();
        pnlContenedorLogin = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        menOpciones = new javax.swing.JMenu();
        menConductor = new javax.swing.JMenuItem();
        menVehiculo = new javax.swing.JMenuItem();
        menAccidente = new javax.swing.JMenuItem();
        menMasOpciones = new javax.swing.JMenuItem();
        cerrarSesion = new javax.swing.JMenuItem();
        menRepor = new javax.swing.JMenu();
        menRepGra = new javax.swing.JMenuItem();
        menRepComp = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        menRepPdf = new javax.swing.JMenuItem();
        menUsuarios = new javax.swing.JMenu();
        menCrearUsuario = new javax.swing.JMenuItem();
        menModificar = new javax.swing.JMenuItem();
        menDoc = new javax.swing.JMenu();
        menDocumento = new javax.swing.JMenuItem();
        menAyuda = new javax.swing.JMenu();
        menAbout = new javax.swing.JMenuItem();

        pnlLogin.setMaximumSize(new java.awt.Dimension(364, 235));
        pnlLogin.setMinimumSize(new java.awt.Dimension(364, 235));

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.setMaximumSize(new java.awt.Dimension(344, 213));
        jPanel1.setMinimumSize(new java.awt.Dimension(344, 213));

        jLabel1.setFont(new java.awt.Font("Arial", 1, 36)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("ENTRAR");

        jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Cooperativa de Transportadores de Occidente");

        jPanel2.setMaximumSize(new java.awt.Dimension(322, 117));
        jPanel2.setMinimumSize(new java.awt.Dimension(322, 117));

        jLabel4.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel4.setText("Usuario:");

        txtUsuario.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        txtUsuario.setText("superuser");
        txtUsuario.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        txtUsuario.setMargin(new java.awt.Insets(0, 5, 0, 5));
        txtUsuario.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                txtUsuarioFocusGained(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel5.setText("Contraseña:");

        btnIngresar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        btnIngresar.setText("Ingresar");
        btnIngresar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        btnIngresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIngresarActionPerformed(evt);
            }
        });

        txtContrasena.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        txtContrasena.setText("superuser");
        txtContrasena.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        txtContrasena.setMargin(new java.awt.Insets(0, 5, 0, 5));
        txtContrasena.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                txtContrasenaFocusGained(evt);
            }
        });
        txtContrasena.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtContrasenaKeyPressed(evt);
            }
        });

        jLabel16.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel16.setForeground(new java.awt.Color(255, 0, 0));
        jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtContrasena, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(btnIngresar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtContrasena, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(btnIngresar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnlLoginLayout = new javax.swing.GroupLayout(pnlLogin);
        pnlLogin.setLayout(pnlLoginLayout);
        pnlLoginLayout.setHorizontalGroup(
            pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLoginLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlLoginLayout.setVerticalGroup(
            pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLoginLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        dlgAbout.setTitle("Acerca de");
        dlgAbout.setMinimumSize(new java.awt.Dimension(517, 250));
        dlgAbout.setModal(true);
        dlgAbout.setResizable(false);

        jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/logo_pequeño.png"))); // NOI18N

        jPanel3.setBorder(new javax.swing.border.MatteBorder(null));

        jLabel11.setText("SICONACCI - Sistema para el control de accidentes");

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel10.setText("Informacion:");

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel8.setText("Creadores:");

        jLabel12.setText("DeveSoft.");

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel9.setText("Version:");

        jLabel14.setText("develsoft01@gmail.com");

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel13.setText("Correo:");

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/devesoft.jpg"))); // NOI18N

        jLabel15.setText("1.2 Beta  Rev.154");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel12)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel14)
                                            .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel2))
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(jLabel11)
                                        .addGap(0, 0, Short.MAX_VALUE)))
                                .addContainerGap())))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel2)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(5, 5, 5)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(5, 5, 5)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(5, 5, 5)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout dlgAboutLayout = new javax.swing.GroupLayout(dlgAbout.getContentPane());
        dlgAbout.getContentPane().setLayout(dlgAboutLayout);
        dlgAboutLayout.setHorizontalGroup(
            dlgAboutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dlgAboutLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(dlgAboutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        dlgAboutLayout.setVerticalGroup(
            dlgAboutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dlgAboutLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lblPrivilegio.setText("jLabel15");

        dlgDocumentos.setTitle("Documentos");
        dlgDocumentos.setMinimumSize(new java.awt.Dimension(581, 464));
        dlgDocumentos.setModal(true);
        dlgDocumentos.setResizable(false);

        cbxFiltrarDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        cbxFiltrarDocumentos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Nombre", "Fecha" }));
        cbxFiltrarDocumentos.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        cbxFiltrarDocumentos.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbxFiltrarDocumentosItemStateChanged(evt);
            }
        });

        jLabel17.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel17.setText("Filtrar por:");

        txtBuscarDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        txtBuscarDocumentos.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        txtBuscarDocumentos.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtBuscarDocumentosCaretUpdate(evt);
            }
        });

        tablaDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        tablaDocumentos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        tablaDocumentos.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        tablaDocumentos.setEditingRow(0);
        tablaDocumentos.setRowHeight(24);
        tablaDocumentos.getTableHeader().setResizingAllowed(false);
        tablaDocumentos.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(tablaDocumentos);

        btnAbrir.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        btnAbrir.setText("Guardar...");
        btnAbrir.setBorder(null);
        btnAbrir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAbrirActionPerformed(evt);
            }
        });

        btnEliminarDocumento.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        btnEliminarDocumento.setText("Eliminar");
        btnEliminarDocumento.setBorder(null);
        btnEliminarDocumento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarDocumentoActionPerformed(evt);
            }
        });

        dcFechaDocumentos.setDateFormatString("yyyy-MM-d");
        dcFechaDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

        lblIdDocumentos.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout dlgDocumentosLayout = new javax.swing.GroupLayout(dlgDocumentos.getContentPane());
        dlgDocumentos.getContentPane().setLayout(dlgDocumentosLayout);
        dlgDocumentosLayout.setHorizontalGroup(
            dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dlgDocumentosLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 553, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(dlgDocumentosLayout.createSequentialGroup()
                            .addComponent(jLabel17)
                            .addGap(10, 10, 10)
                            .addComponent(cbxFiltrarDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(dcFechaDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(txtBuscarDocumentos)))
                    .addGroup(dlgDocumentosLayout.createSequentialGroup()
                        .addComponent(btnAbrir, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(btnEliminarDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblIdDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        dlgDocumentosLayout.setVerticalGroup(
            dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dlgDocumentosLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cbxFiltrarDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtBuscarDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(dcFechaDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAbrir, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnEliminarDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblIdDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Siconacci");
        setMinimumSize(new java.awt.Dimension(973, 684));
        setResizable(false);

        pnlContenedor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        pnlContenedor.setMaximumSize(new java.awt.Dimension(973, 662));
        pnlContenedor.setMinimumSize(new java.awt.Dimension(973, 662));

        pnlContenedorLogin.setBorder(new javax.swing.border.MatteBorder(null));
        pnlContenedorLogin.setMaximumSize(new java.awt.Dimension(364, 230));
        pnlContenedorLogin.setMinimumSize(new java.awt.Dimension(364, 230));
        pnlContenedorLogin.setPreferredSize(new java.awt.Dimension(364, 230));

        javax.swing.GroupLayout pnlContenedorLoginLayout = new javax.swing.GroupLayout(pnlContenedorLogin);
        pnlContenedorLogin.setLayout(pnlContenedorLoginLayout);
        pnlContenedorLoginLayout.setHorizontalGroup(
            pnlContenedorLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        pnlContenedorLoginLayout.setVerticalGroup(
            pnlContenedorLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/devesoft.jpg"))); // NOI18N

        javax.swing.GroupLayout pnlContenedorLayout = new javax.swing.GroupLayout(pnlContenedor);
        pnlContenedor.setLayout(pnlContenedorLayout);
        pnlContenedorLayout.setHorizontalGroup(
            pnlContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContenedorLayout.createSequentialGroup()
                .addContainerGap(316, Short.MAX_VALUE)
                .addGroup(pnlContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlContenedorLayout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlContenedorLayout.createSequentialGroup()
                        .addComponent(pnlContenedorLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(310, 310, 310))))
        );
        pnlContenedorLayout.setVerticalGroup(
            pnlContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlContenedorLayout.createSequentialGroup()
                .addContainerGap(209, Short.MAX_VALUE)
                .addComponent(pnlContenedorLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(158, 158, 158)
                .addComponent(jLabel6)
                .addContainerGap())
        );

        jMenuBar1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jMenuBar1.setAlignmentY(0.5F);

        menOpciones.setText("Opciones");
        menOpciones.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

        menConductor.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menConductor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/empleado.png"))); // NOI18N
        menConductor.setText("Ingresar Conductor");
        menConductor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menConductorActionPerformed(evt);
            }
        });
        menOpciones.add(menConductor);

        menVehiculo.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menVehiculo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/vehiculo.png"))); // NOI18N
        menVehiculo.setText("Ingresar Vehiculo");
        menVehiculo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menVehiculoActionPerformed(evt);
            }
        });
        menOpciones.add(menVehiculo);

        menAccidente.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menAccidente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/accidente.png"))); // NOI18N
        menAccidente.setText("Ingresar Accidente");
        menAccidente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menAccidenteActionPerformed(evt);
            }
        });
        menOpciones.add(menAccidente);

        menMasOpciones.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menMasOpciones.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/opciones.png"))); // NOI18N
        menMasOpciones.setText("Mas Opciones...");
        menMasOpciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menMasOpcionesActionPerformed(evt);
            }
        });
        menOpciones.add(menMasOpciones);

        cerrarSesion.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        cerrarSesion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cerrar_sesion.png"))); // NOI18N
        cerrarSesion.setText("Cerrar Sesión");
        cerrarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cerrarSesionActionPerformed(evt);
            }
        });
        menOpciones.add(cerrarSesion);

        jMenuBar1.add(menOpciones);

        menRepor.setText("Reporte");
        menRepor.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

        menRepGra.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menRepGra.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/graficas.png"))); // NOI18N
        menRepGra.setText("Generar Graficas Generales");
        menRepGra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menRepGraActionPerformed(evt);
            }
        });
        menRepor.add(menRepGra);

        menRepComp.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menRepComp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/graph-icon.png"))); // NOI18N
        menRepComp.setText("Generar Reportes de Comparación");
        menRepComp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menRepCompActionPerformed(evt);
            }
        });
        menRepor.add(menRepComp);

        jMenuItem1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/especificos.png"))); // NOI18N
        jMenuItem1.setText("Generar Reportes Específicos");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        menRepor.add(jMenuItem1);

        menRepPdf.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menRepPdf.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/reporte.png"))); // NOI18N
        menRepPdf.setText("Generar Reportes en *.pdf, *.xls, *.csv ...");
        menRepPdf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menRepPdfActionPerformed(evt);
            }
        });
        menRepor.add(menRepPdf);

        jMenuBar1.add(menRepor);

        menUsuarios.setText("Usuarios");
        menUsuarios.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

        menCrearUsuario.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menCrearUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/new_user.png"))); // NOI18N
        menCrearUsuario.setText("Crear Usuario");
        menCrearUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menCrearUsuarioActionPerformed(evt);
            }
        });
        menUsuarios.add(menCrearUsuario);

        menModificar.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/user_delete.png"))); // NOI18N
        menModificar.setText("Modifica y Eliminar");
        menModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menModificarActionPerformed(evt);
            }
        });
        menUsuarios.add(menModificar);

        jMenuBar1.add(menUsuarios);

        menDoc.setText("Registros");
        menDoc.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

        menDocumento.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menDocumento.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/documentos.png"))); // NOI18N
        menDocumento.setText("Documentos");
        menDocumento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menDocumentoActionPerformed(evt);
            }
        });
        menDoc.add(menDocumento);

        jMenuBar1.add(menDoc);

        menAyuda.setText("Ayuda");
        menAyuda.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menAyuda.setPreferredSize(new java.awt.Dimension(46, 19));

        menAbout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        menAbout.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        menAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/about.png"))); // NOI18N
        menAbout.setText("Acerca de");
        menAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menAboutActionPerformed(evt);
            }
        });
        menAyuda.add(menAbout);

        jMenuBar1.add(menAyuda);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlContenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlContenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
//______________________________________________________________________________

    private void menConductorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menConductorActionPerformed
        agregarConductor();
    }//GEN-LAST:event_menConductorActionPerformed
//______________________________________________________________________________

    private void menVehiculoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menVehiculoActionPerformed
        agregarVehiculo();
    }//GEN-LAST:event_menVehiculoActionPerformed
//______________________________________________________________________________

    private void menAccidenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menAccidenteActionPerformed
        agregarAccidente();
    }//GEN-LAST:event_menAccidenteActionPerformed
//______________________________________________________________________________

    private void menMasOpcionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menMasOpcionesActionPerformed
        agregarOpciones();
    }//GEN-LAST:event_menMasOpcionesActionPerformed
//______________________________________________________________________________

    private void menAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menAboutActionPerformed
        dlgAbout.setLocationRelativeTo(null);
        dlgAbout.setVisible(true);
    }//GEN-LAST:event_menAboutActionPerformed
//______________________________________________________________________________

    private void btnIngresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIngresarActionPerformed
        Acceder();
    }//GEN-LAST:event_btnIngresarActionPerformed
//______________________________________________________________________________

private void menRepPdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menRepPdfActionPerformed
    Reporte reporte = new Reporte(this, true);
    reporte.setVisible(true);
}//GEN-LAST:event_menRepPdfActionPerformed
//______________________________________________________________________________

private void menRepGraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menRepGraActionPerformed
    ReporteGrafi reportegra = new ReporteGrafi(this, true);
    reportegra.setVisible(true);
}//GEN-LAST:event_menRepGraActionPerformed
//______________________________________________________________________________

    private void cerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cerrarSesionActionPerformed
        llamarContainer();
    }//GEN-LAST:event_cerrarSesionActionPerformed
//______________________________________________________________________________

private void menRepCompActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menRepCompActionPerformed
    ReporteGrafCompa reporteComp = new ReporteGrafCompa(this, true);
    reporteComp.setVisible(true);
}//GEN-LAST:event_menRepCompActionPerformed
//______________________________________________________________________________

    private void menCrearUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menCrearUsuarioActionPerformed
        u.setLocationRelativeTo(this);
        u.setVisible(true);
    }//GEN-LAST:event_menCrearUsuarioActionPerformed
//______________________________________________________________________________

    private void menModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menModificarActionPerformed
        u.llenarUsuarios();
        u.dlgTablaUsuarios.setLocationRelativeTo(this);
        u.dlgTablaUsuarios.setVisible(true);
    }//GEN-LAST:event_menModificarActionPerformed
//______________________________________________________________________________

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        ReporteEspeci reporteEsp = new ReporteEspeci(this, true);
        reporteEsp.setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed
//______________________________________________________________________________

    private void txtContrasenaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtContrasenaFocusGained
        mayusActivado();
    }//GEN-LAST:event_txtContrasenaFocusGained
//______________________________________________________________________________

    private void txtContrasenaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtContrasenaKeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_CAPS_LOCK) {
            mayusActivado();
        }else if(evt.getKeyCode() == KeyEvent.VK_ENTER){
            Acceder();
        }
        
    }//GEN-LAST:event_txtContrasenaKeyPressed
//______________________________________________________________________________

    private void txtUsuarioFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtUsuarioFocusGained
        jLabel16.setText("");
    }//GEN-LAST:event_txtUsuarioFocusGained
//______________________________________________________________________________

private void menDocumentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menDocumentoActionPerformed
    tablaDocumentos.setAutoCreateRowSorter(true);
    dlgDocumentos.setLocationRelativeTo(null);
    ((JTextFieldDateEditor) dcFechaDocumentos.getDateEditor()).setEditable(false);
    tamanoTabla();
    //ocultarColumnas();
    llenarDocumentos("");
    dlgDocumentos.setVisible(true);
}//GEN-LAST:event_menDocumentoActionPerformed
//______________________________________________________________________________

    private void cbxFiltrarDocumentosItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbxFiltrarDocumentosItemStateChanged

        int Valor_dos = cbxFiltrarDocumentos.getSelectedIndex();

        if (Valor_dos == 1) {
            dcFechaDocumentos.setDate(null);
            txtBuscarDocumentos.setVisible(false);
            dcFechaDocumentos.setVisible(true);
            txtBuscarDocumentos.setText("");
        } else if (Valor_dos == 0) {
            dcFechaDocumentos.setDate(null);
            txtBuscarDocumentos.setVisible(true);
            dcFechaDocumentos.setVisible(false);
            txtBuscarDocumentos.setText("");
        }

    }//GEN-LAST:event_cbxFiltrarDocumentosItemStateChanged
//______________________________________________________________________________

    private void txtBuscarDocumentosCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtBuscarDocumentosCaretUpdate
        if (txtBuscarDocumentos.getText() == null) {
            llenarDocumentos("");
        } else {
            llenarDocumentos(txtBuscarDocumentos.getText());
        }
    }//GEN-LAST:event_txtBuscarDocumentosCaretUpdate
//______________________________________________________________________________

    private void btnAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAbrirActionPerformed
        try {
            extraerDocumento();
        } catch (IOException | SQLException ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_btnAbrirActionPerformed
//______________________________________________________________________________

    private void btnEliminarDocumentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarDocumentoActionPerformed

        eliminarDocumento();

    }//GEN-LAST:event_btnEliminarDocumentoActionPerformed
//______________________________________________________________________________
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAbrir;
    private javax.swing.JButton btnEliminarDocumento;
    private javax.swing.JButton btnIngresar;
    private javax.swing.JComboBox cbxFiltrarDocumentos;
    private javax.swing.JMenuItem cerrarSesion;
    private com.toedter.calendar.JDateChooser dcFechaDocumentos;
    private javax.swing.JDialog dlgAbout;
    private javax.swing.JDialog dlgDocumentos;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblIdDocumentos;
    public static javax.swing.JLabel lblPrivilegio;
    private javax.swing.JMenuItem menAbout;
    private javax.swing.JMenuItem menAccidente;
    private javax.swing.JMenu menAyuda;
    private javax.swing.JMenuItem menConductor;
    private javax.swing.JMenuItem menCrearUsuario;
    private javax.swing.JMenu menDoc;
    private javax.swing.JMenuItem menDocumento;
    private javax.swing.JMenuItem menMasOpciones;
    private javax.swing.JMenuItem menModificar;
    private javax.swing.JMenu menOpciones;
    private javax.swing.JMenuItem menRepComp;
    private javax.swing.JMenuItem menRepGra;
    private javax.swing.JMenuItem menRepPdf;
    private javax.swing.JMenu menRepor;
    private javax.swing.JMenu menUsuarios;
    private javax.swing.JMenuItem menVehiculo;
    private javax.swing.JPanel pnlContenedor;
    private javax.swing.JPanel pnlContenedorLogin;
    private javax.swing.JPanel pnlLogin;
    private javax.swing.JTable tablaDocumentos;
    private javax.swing.JTextField txtBuscarDocumentos;
    private javax.swing.JPasswordField txtContrasena;
    private javax.swing.JTextField txtUsuario;
    // End of variables declaration//GEN-END:variables
}
